home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 1.iso / dist / fw_cyrus-imapd.idb / usr / freeware / sbin / cyradm.z / cyradm
Text File  |  2001-07-06  |  10KB  |  329 lines

  1. #! /bin/sh
  2. # Copyright (c) 2000 Carnegie Mellon University.  All rights reserved.
  3. #
  4. # Redistribution and use in source and binary forms, with or without
  5. # modification, are permitted provided that the following conditions
  6. # are met:
  7. #
  8. # 1. Redistributions of source code must retain the above copyright
  9. #    notice, this list of conditions and the following disclaimer. 
  10. #
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. #    notice, this list of conditions and the following disclaimer in
  13. #    the documentation and/or other materials provided with the
  14. #    distribution.
  15. #
  16. # 3. The name "Carnegie Mellon University" must not be used to
  17. #    endorse or promote products derived from this software without
  18. #    prior written permission. For permission or any other legal
  19. #    details, please contact  
  20. #      Office of Technology Transfer
  21. #      Carnegie Mellon University
  22. #      5000 Forbes Avenue
  23. #      Pittsburgh, PA  15213-3890
  24. #      (412) 268-4387, fax: (412) 268-7395
  25. #      tech-transfer@andrew.cmu.edu
  26. #
  27. # 4. Redistributions of any form whatsoever must retain the following
  28. #    acknowledgment:
  29. #    "This product includes software developed by Computing Services
  30. #     at Carnegie Mellon University (http://www.cmu.edu/computing/)."
  31. #
  32. # CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
  33. # THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  34. # AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
  35. # FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  36. # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
  37. # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
  38. # OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  39. #
  40. #
  41. case "x$BASH_VERSION" in
  42. x) exec /usr/bin/perl5 -MCyrus::IMAP::Shell -e shell -- ${1+"$@"} ;;
  43. *) exec /usr/bin/perl5 -MCyrus::IMAP::Shell -e shell -- "$@" ;;
  44. esac
  45. echo "$0: how did I get here?" >&2
  46. exit 1
  47.  
  48. =head1 NAME
  49.  
  50. cyradm - Cyrus administration shell, alter ego of Cyrus::IMAP::Shell
  51.  
  52. =head1 SYNOPSIS
  53.  
  54.   $ cyradm [--user user] [--[no]rc] [--systemrc file] [--userrc file] \
  55.   > [--port n] [--auth mechanism] [--server] server
  56.  
  57. but possibly
  58.  
  59.   $ perl -MCyrus::IMAP::Shell -e 'run("myscript")'
  60.  
  61. or even (not recommended)
  62.  
  63.   use IMAP::Admin::Shell;
  64.  
  65.   run('myscriptname');
  66.  
  67. =head1 DESCRIPTION
  68.  
  69. This module implements B<cyradm> in Perl.  It is a shell around
  70. L<Cyrus::IMAP::Admin>.  Commands are provided in both Tcl-compatible
  71. forms and GNU-style long option forms.
  72.  
  73. =head1 COMMANDS
  74.  
  75. =over 4
  76.  
  77. =item C<authenticate> [C<--minssf> I<N>] [C<--maxssf> I<N>] [C<--mechanisms> I<list>] [I<user>]
  78.  
  79. =item C<auth> [C<--minssf> I<N>] [C<--maxssf> I<N>] [C<--mechanisms> I<list>] [I<user>]
  80.  
  81. =item C<login> [C<--minssf> I<N>] [C<--maxssf> I<N>] [C<--mechanisms> I<list>] [I<user>]
  82.  
  83. Authenticate to server.  You must already be connected to a server and
  84. Cyrus imapd will refuse to allow you to re-authenticate once you have
  85. authenticated once.
  86.  
  87. =item C<chdir> I<directory>
  88.  
  89. =item C<cd> I<directory>
  90.  
  91. Change directory.  A C<pwd> builtin is not provided, but the default command
  92. action will run C<pwd> from a shell if invoked.
  93.  
  94. =item C<createmailbox> [C<--partition> I<partition>] I<mailbox>
  95.  
  96. =item C<createmailbox> I<mailbox> I<partition>
  97.  
  98. =item C<create> [C<--partition> I<partition>] I<mailbox>
  99.  
  100. =item C<create> I<mailbox> I<partition>
  101.  
  102. =item C<cm> [C<--partition> I<partition>] I<mailbox>
  103.  
  104. =item C<cm> I<mailbox> I<partition>
  105.  
  106. Create a mailbox on the default or a specified partition.  Both old-style
  107. and getopt-style usages are accepted (combining them will produce an error).
  108.  
  109. =item C<deleteaclmailbox> I<mailbox> I<id> [...]
  110.  
  111. =item C<deleteacl> I<mailbox> I<id> [...]
  112.  
  113. =item C<dam> I<mailbox> I<id> [...]
  114.  
  115. Remove ACLs from the specified mailbox.
  116.  
  117. =item C<deletemailbox> I<mailbox>
  118.  
  119. =item C<delete> I<mailbox>
  120.  
  121. =item C<dm> I<mailbox>
  122.  
  123. Delete the specified mailbox.
  124.  
  125. Administrators do not have implicit delete rights on mailboxes.  Use the
  126. B<setaclmailbox> command to grant the C<d> permission to your principal
  127. if you need to delete a mailbox you do not own.
  128.  
  129. Note that the online help admits to an optional host argument.  This argument
  130. is not currently used, and will be rejected with an error if specified; it
  131. is reserved for IMSP.
  132.  
  133. =item C<disconnect>
  134.  
  135. =item C<disc>
  136.  
  137. Disconnect from the current server.  The prompt will revert to C<cyradmE<gt>>.
  138.  
  139. =item C<exit> [I<number>]
  140.  
  141. =item C<quit> [I<number>]
  142.  
  143. Exit B<cyradm>, optionally with a specific exit status; the exit status of the
  144. last command will be used if one is not specified.
  145.  
  146. =item help [command]
  147.  
  148. =item ? [command]
  149.  
  150. Show help for C<command> or all commands.
  151.  
  152. =item listaclmailbox I<mailbox>
  153.  
  154. =item listacl I<mailbox>
  155.  
  156. =item lam I<mailbox>
  157.  
  158. List ACLs on the specified mailbox.
  159.  
  160. =item C<listmailbox> [C<--subscribed>] [I<pattern> [I<reference>]]
  161.  
  162. =item C<list> [C<--subscribed>] [I<pattern> [I<reference>]]
  163.  
  164. =item C<lm> [C<--subscribed>] [I<pattern> [I<reference>]]
  165.  
  166. List all, or all subscribed, mailboxes matching the specified pattern.
  167. The pattern may have embedded wildcards C<'*'> or C<'%'>, which match
  168. anything or anything except the separator character, respectively.
  169.  
  170. Mailboxes returned will be relative to the specified reference if one
  171. is specified.  This allows a mailbox list to be limited to a particular
  172. hierarchy.
  173.  
  174. In some cases when the C<'%'> wildcard is used to end a pattern, it may
  175. match an entry which is not a mailbox but which contains other mailboxes.
  176. In this case, the entry will be parenthesized to indicate that it is a
  177. root for other mailboxes, as opposed to a mailbox itself.
  178.  
  179. =item C<listquota> I<root>
  180.  
  181. =item C<lq> I<root>
  182.  
  183. List quotas on specified root.  If the specified mailbox path does not have
  184. a quota assigned, an error will be raised; see L<listquotaroot> for a way to
  185. find the quota root for a mailbox.
  186.  
  187. =item C<listquotaroot> I<mailbox>
  188.  
  189. =item C<lqm> I<mailbox>
  190.  
  191. =item C<lqr> I<mailbox?>
  192.  
  193. show quota roots and quotas for mailbox
  194.  
  195. =item C<renamemailbox> [C<--partition> I<partition>] I<oldname> I<newname>
  196.  
  197. =item C<rename> [C<--partition> I<partition>] I<oldname> I<newname>
  198.  
  199. =item C<renm> [C<--partition> I<partition>] I<oldname> I<newname>
  200.  
  201. =item C<renamemailbox> I<oldname> I<newname> [I<partition>]
  202.  
  203. =item C<rename> I<oldname> I<newname> [I<partition>]
  204.  
  205. =item C<renm> I<oldname> I<newname> [I<partition>]
  206.  
  207. Rename the specified mailbox, optionally moving it to a different partition.
  208. Both old-style and getopt-style usages are accepted; combining them will
  209. produce an error.
  210.  
  211. =item server [--noauthenticate] [server]
  212.  
  213. =item connect [--noauthenticate] [server]
  214.  
  215. =item servername [--noauthenticate] [server]
  216.  
  217. With no arguments, show the current server.  With an argument, connect to that
  218. server.  It will prompt for automatic login unless the C<--noauthenticate>
  219. option is specified.  (This may change; in particular, either automatic
  220. authentication will be removed or all C<authenticate> options will be added.)
  221.  
  222. When connected to a server, B<cyradm>'s prompt changes from C<cyradmE<gt>> to
  223. C<servernameE<gt>>, where I<servername> is the fully qualified domain name
  224. of the connected server.
  225.  
  226. =item C<setaclmailbox> I<mailbox> I<id> I<rights> [I<id> I<rights> ...]
  227.  
  228. =item C<setacl> I<mailbox> I<id> I<rights> [I<id> I<rights> ...]
  229.  
  230. =item C<sam> I<mailbox> I<id> I<rights> [I<id> I<rights> ...]
  231.  
  232. Set ACLs on a mailbox.  The ACL may be one of the special strings C<none>,
  233. C<read> (C<lrs>), C<post> (C<lrsp>), C<append> (C<lrsip>), C<write>
  234. (C<lrswipcd>), or C<all> (C<lrswipcda>), or any combinations of the ACL codes:
  235.  
  236. =over 4
  237.  
  238. =item l
  239.  
  240. Lookup (visible to LIST/LSUB/UNSEEN)
  241.  
  242. =item r
  243.  
  244. Read (SELECT, CHECK, FETCH, PARTIAL, SEARCH, COPY source)
  245.  
  246. =item s
  247.  
  248. Seen (STORE \SEEN)
  249.  
  250. =item w
  251.  
  252. Write flags other than \SEEN and \DELETED
  253.  
  254. =item i
  255.  
  256. Insert (APPEND, COPY destination)
  257.  
  258. =item p
  259.  
  260. Post (send mail to mailbox)
  261.  
  262. =item c
  263.  
  264. Create (subfolders)
  265.  
  266. =item d
  267.  
  268. Delete (STORE \DELETED, EXPUNGE)
  269.  
  270. =item a
  271.  
  272. Administer (SETACL)
  273.  
  274. =back
  275.  
  276. =item C<setquota> I<root> I<resource> I<value> [I<resource> I<value> ...]
  277.  
  278. =item C<sq> I<root> I<resource> I<value> [I<resource> I<value> ...]
  279.  
  280. Set a quota on the specified root, which may or may not be an actual mailbox.
  281. The only I<resource> understood by B<Cyrus> is C<STORAGE>.
  282.  
  283. =back
  284.  
  285. =head1 NOTES
  286.  
  287. GNU-style long options must be given in their entirety; Tcl-style options
  288. may be abbreviated.
  289.  
  290. Tcl-style options are provided as a compatibility feature.  They will
  291. probably go away in the future.
  292.  
  293. Multiple commands can be given on a line, separated by C<';'> characters.
  294.  
  295. All commands set an exit status, which at present is not useful.
  296.  
  297. Unknown commands are passed to a subshell for execution.
  298.  
  299. The Tcl version of B<cyradm> is used for scripting as well as interactively.
  300. While this is possible to a limited extent by use of the C<run> method,
  301. scripting would normally be done with C<Cyrus::IMAP::Admin>, which is far
  302. more flexible than either interactive C<cyradm> or the Tcl scripting
  303. mechanism for Cyrus.
  304.  
  305. B<cyradm> understands B</bin/sh>-style redirection:  any command can have
  306. its standard or error output redirected, with all B<sh>-style redirections
  307. (except C<E<lt>E<gt>>) supported.  It does not currently understand pipes
  308. or backgrounding.
  309.  
  310. If the C<Term::Readline::Perl> or C<Term::Readline::GNU> modules are
  311. available, B<cyradm> will use it.
  312.  
  313. An alias facility is implemented internally, but no access is currently
  314. provided to it.  This will change, if only to allow some of the predefined
  315. aliases to be removed if they conflict with useful shell commands.
  316.  
  317. =head1 AUTHOR
  318.  
  319. Brandon S. Allbery, allbery@ece.cmu.edu
  320.  
  321. =head1 SEE ALSO
  322.  
  323. Cyrus::IMAP::Admin
  324. Term::ReadLine
  325. sh(1), perl(1), imapd(8).
  326.  
  327. =cut
  328.